//
// Created by chizuru on 2025/9/2.
//

#pragma once
#include <any>


struct IDeviceIO {
    virtual ~IDeviceIO() = default;

    /**
     * write returns number of bytes written, negative for error
     * Need to implement blocking write operations
     * @param data
     * @param size
     * @return
     */
    virtual int write( const char* data, size_t size) = 0;

    /**
     * read returns number of bytes read, 0 for none, negative for error
     * Need to implement non blocking read operations
     * @param buf
     * @param maxSize
     * @return
     */
    virtual int read( char* buf, size_t maxSize) = 0;

    virtual int flushReadAndWrite() = 0;
};

